import {DeviceInfo, Dimensions, PixelRatio, Platform,StatusBar} from 'react-native';
import {Toast} from 'teaset'

import { FontSize } from './FontSize';
import { Px2Dp, yuan} from './Tool';

const { height, width } = Dimensions.get('window');

// 系统是iOS
global.iOS = Platform.OS === 'ios';
// 系统是安卓
global.Android = Platform.OS === 'android';
// 获取屏幕宽度
global.WINDOWS_WIDTH = width;
// 获取屏幕高度
global.WINDOWS_HEIGHT = height;
// 获取屏幕分辨率
global.PixelRatio = PixelRatio.get();
// 最小线宽
global.pixel = 1 / PixelRatio;
// 适配字体
global.FONT_SIZE = FontSize;
// 屏幕适配
global.px2dp = Px2Dp;

// 分转元保留2位小数
global.yuan = yuan;

//所有子页面均可直接调用global.Toast来吐司提示消息
global.toast = Toast;

const NAV_BAR_HEIGHT_IOS = 44;//导航栏在iOS中的高度
const NAV_BAR_HEIGHT_ANDROID = 50;//导航栏在Android中的高度
const NAV_BAR_HEIGHT = Platform.OS === 'ios' ? NAV_BAR_HEIGHT_IOS : NAV_BAR_HEIGHT_ANDROID;
const STATUS_BAR_HEIGHT = (Platform.OS !== 'ios' || DeviceInfo.isIPhoneX_deprecated) ? StatusBar.currentHeight : 20;//状态栏的高度
global.NavHeight = NAV_BAR_HEIGHT + STATUS_BAR_HEIGHT
global.NAV_BAR_HEIGHT = NAV_BAR_HEIGHT //头部导航的高度
global.STATUS_BAR_HEIGHT = STATUS_BAR_HEIGHT //头部状态栏高度

